#pragma once
#pragma warning(disable:4996)       // disable checked iterator errors http://msdn.microsoft.com/en-us/library/aa985965(VS.80).aspx 

//
// Copyright (C) 2011 Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.101

#include <Macros.h>
#include <CoVector.h>
#include <CoMatrix.h>
#include <CoCube.h>
#include <ValueHelpers.h>
#include <Settings.h>

#include <gen/QL/Models/Marketmodels/MarketModelPathwiseMultiProduct.h>
#pragma unmanaged 
#include <ql\models\marketmodels\products\pathwise\pathwiseproductcaplet.hpp>
#include <boost/smart_ptr/detail/spinlock.hpp>
#pragma managed 

using namespace System;
using namespace QuantLib;
using namespace Cephei;

using namespace Cephei::QL::Models::Marketmodels;
#undef HANDLE
#undef ABSTRACT
#undef STRUCT
namespace Cephei { namespace QL { namespace Models { namespace Marketmodels { namespace Products { namespace Pathwise {
	//////////////////////////////////////////////////////////////////////////////////////////////
	// implementation of IMarketModelPathwiseMultiCaplet
	public ref class CMarketModelPathwiseMultiCaplet : 
            public CMarketModelPathwiseMultiProduct,
            public Cephei::QL::Models::Marketmodels::Products::Pathwise::IMarketModelPathwiseMultiCaplet
	{
	protected: 
		boost::shared_ptr<QuantLib::MarketModelPathwiseMultiCaplet>* _ppMarketModelPathwiseMultiCaplet;
#ifdef HANDLE
		QuantLib::Handle<QuantLib::MarketModelPathwiseMultiCaplet>* _phMarketModelPathwiseMultiCaplet;
#endif
		Object^ _MarketModelPathwiseMultiCapletOwner;     // reference to object that manages the storage for this object
	internal:
		CMarketModelPathwiseMultiCaplet (Cephei::IVector<Double>^ rateTimes, Cephei::IVector<Double>^ accruals, Cephei::IVector<Double>^ paymentTimes, Cephei::IVector<Double>^ strikes);
        CMarketModelPathwiseMultiCaplet (boost::shared_ptr<QuantLib::MarketModelPathwiseMultiCaplet>& childNative, Object^ owner);
        CMarketModelPathwiseMultiCaplet (QuantLib::MarketModelPathwiseMultiCaplet& childNative, Object^ owner);
        CMarketModelPathwiseMultiCaplet (CMarketModelPathwiseMultiCaplet^ copy);
        CMarketModelPathwiseMultiCaplet (System::Type^ t);
#ifdef STRUCT
        CMarketModelPathwiseMultiCaplet (QuantLib::MarketModelPathwiseMultiCaplet childNative);
#endif       
#ifdef HANDLE
		CMarketModelPathwiseMultiCaplet (QuantLib::Handle<QuantLib::MarketModelPathwiseMultiCaplet>& childNative, Object^ owner);
		CMarketModelPathwiseMultiCaplet (QuantLib::Handle<QuantLib::MarketModelPathwiseMultiCaplet> childNative);
#endif
		virtual ~CMarketModelPathwiseMultiCaplet ();
		!CMarketModelPathwiseMultiCaplet ();

	internal:
		QuantLib::MarketModelPathwiseMultiCaplet& GetReference ();
		boost::shared_ptr<QuantLib::MarketModelPathwiseMultiCaplet>& GetShared ();
		QuantLib::MarketModelPathwiseMultiCaplet* GetPointer ();
        void SetMarketModelPathwiseMultiCaplet (boost::shared_ptr<QuantLib::MarketModelPathwiseMultiCaplet> native)
        {
            if (_ppMarketModelPathwiseMultiCaplet != NULL)
                delete _ppMarketModelPathwiseMultiCaplet;
            _ppMarketModelPathwiseMultiCaplet = new boost::shared_ptr<QuantLib::MarketModelPathwiseMultiCaplet> (native);
            SetMarketModelPathwiseMultiProduct (boost::dynamic_pointer_cast<QuantLib::MarketModelPathwiseMultiProduct> (*_ppMarketModelPathwiseMultiCaplet));
        }
#ifdef HANDLE
		QuantLib::Handle<QuantLib::MarketModelPathwiseMultiCaplet>& GetHandle ();
#endif
		virtual bool HasNative () override;
    public:
        property Boolean AlreadyDeflated 
        {
		    virtual Boolean get () ;
        }
        property Cephei::QL::Models::Marketmodels::IEvolutionDescription^ Evolution 
        {
		    virtual Cephei::QL::Models::Marketmodels::IEvolutionDescription^ get () ;
        }
        property UInt64 MaxNumberOfCashFlowsPerProductPerStep 
        {
		    virtual UInt64 get () ;
        }
        property UInt64 NumberOfProducts 
        {
		    virtual UInt64 get () ;
        }
        property Cephei::IVector<Double>^ PossibleCashFlowTimes 
        {
		    virtual Cephei::IVector<Double>^ get () ;
        }
        property Cephei::QL::Models::Marketmodels::Products::Pathwise::IMarketModelPathwiseMultiCaplet^ Reset 
        {
		    virtual Cephei::QL::Models::Marketmodels::Products::Pathwise::IMarketModelPathwiseMultiCaplet^ get () ;
        }
        property Cephei::IVector<UInt64>^ SuggestedNumeraires 
        {
		    virtual Cephei::IVector<UInt64>^ get () ;
        }
    };
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Factory class
	public ref class CMarketModelPathwiseMultiCaplet_Factory : public System::MarshalByRefObject,  public IMarketModelPathwiseMultiCaplet_Factory
	{
	public:
        virtual IMarketModelPathwiseMultiCaplet^ Create (Cephei::IVector<Double>^ rateTimes, Cephei::IVector<Double>^ accruals, Cephei::IVector<Double>^ paymentTimes, Cephei::IVector<Double>^ strikes);
    };
   
/*Cephei*/ } /*QL*/ } /*Models*/ } /*Marketmodels*/ } /*Products*/ } /*Pathwise */}
